package com.donger.common.core.constant;

/**
 * 安全认证配置类
 *
 * @author aeizzz
 */
public interface SecurityConstants {


    /**
     * {bcrypt} 加密的特征码
     */
    String BCRYPT = "{bcrypt}";

    /**
     * sys_oauth_client_details 表的字段，不包括client_id、client_secret
     */
    String CLIENT_FIELDS = "client_id,CONCAT('{noop}',client_secret) as client_secret, resource_ids, scope, "
            + "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
            + "refresh_token_validity, additional_information, autoapprove";

    /**
     * JdbcClientDetailsService 查询语句
     */
    String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS
            + " from sys_oauth_client_details";

    /**
     * 默认的查询语句
     */
    String DEFAULT_FIND_STATEMENT = BASE_FIND_STATEMENT + " order by client_id";

    /**
     * 按条件client_id 查询
     */
    String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ?";


    /**
     * 客户端模式
     */
    String CLIENT_CREDENTIALS = "client_credentials";

    String OAUTH_PREFIX = "oauth:";


    /**
     * 验证码长度
     */
    String CODE_SIZE = "4";


    /**
     * 用户ID字段
     */
    String DETAILS_USER_ID = "user_id";

    /**
     * 用户名字段
     */
    String DETAILS_USERNAME = "username";

    /**
     * 用户部门字段
     */
    String DETAILS_DEPT_ID = "dept_id";

    /**
     * 角色前缀
     */
    String ROLE = "ROLE_";


    /**
     * 自定义登录URL
     */
    String MOBILE_TOKEN_URL = "/mobile/token/*";

    String DEFAULT_PARAMETER_NAME_CODE_SMS = "sms";
    String DEFAULT_PARAMETER_CODE_SMS_URL = "/mobile/token/sms";

    String DEFAULT_PARAMETER_NAME_CODE_IMAGE = "image";
    String DEFAULT_PARAMETER_CODE_IMAGE_URL = "/oauth/token";

    String BOOT_PREFIX = "boot_";

    String OAUTH_PREEIX = "oauth:";

    /**
     * 微信获取OPENID
     */
    String WX_AUTHORIZATION_CODE_URL = "https://api.weixin.qq.com/sns/oauth2/access_token" +
            "?appid=%s&secret=%s&code=%s&grant_type=authorization_code";

    /**
     * 码云获取token
     */
    String GITEE_AUTHORIZATION_CODE_URL = "https://gitee.com/oauth/token?grant_type=" +
            "authorization_code&code=%S&client_id=%s&redirect_uri=" +
            "%s&client_secret=%s";


    /**
     * 微信认证token
     */
    String WEWORK_AUTHORIZATION_TOKEN = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=%s&corpsecret=%s";
    /**
     * 微信获取用户信息
     */
    String WEWORK_AUTHORIZATION_USERID = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=%s&code=%s";


    /**
     * 码云获取用户信息
     */
    String GITEE_USER_INFO_URL = "https://gitee.com/api/v5/user?access_token=%s";

}
